﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace iLangl.Model
{
	public class SyncedOneWayData
	{
		public SyncedOneWayData()
		{
			_timeSpans = new Hashtable();
		}

		public String Subscriber { get; set; }

		public ICompany[] Companies { get; set; }
		public IProject[] Projects { get; set; }
		public ISerializedAlert[] Alerts { get; set; }
		
		private Hashtable _timeSpans;
		public Hashtable TimeSpans 
		{
			get
			{
				return _timeSpans;
			}
			set
			{
				_timeSpans = value;
			}
		}

		public TimeSpan GetTimeSpan(object key)
		{
			object result = TimeSpans[key];

			if (result == null)
				return TimeSpan.MinValue;

			return (TimeSpan)result;
		}

		public bool IsDataPresent()
		{
			if ((Companies != null) && (Companies.Length > 0))
				return true;

			if ((Projects != null) && (Projects.Length > 0))
				return true;

			if ((Alerts != null) && (Alerts.Length > 0))
				return true;

			return false;
		}
	}
}
